//
//  BaseViewController.m
//  danpin
//
//  Created by chuangjia on 2/7/15.
//  Copyright (c) 2015 chuangjia. All rights reserved.
//

#import "BaseViewController.h"
#import "UserLoginVC.h"
#import "UserRegisterNameVC.h"
#import "ZShare.h"
#import "UINavigationController+YRBackGesture.h"
#import "UserNavigationController.h"
#import "SDImageCache.h"

@interface BaseViewController ()<UserDelegate>

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor =[UIColor whiteColor];
    self.navigationController.navigationBarHidden=YES;

    __weak typeof (self) wSelf = self;
    [self.navigationController panGestureRecognizerBlock:^(id vc) {
        [wSelf panGestureRecognizerBack];
    }];
}
-(void)panGestureRecognizerBack
{
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
      DLog(@"%s", __PRETTY_FUNCTION__);
}
-(void)dealloc
{
    [[SDImageCache sharedImageCache] clearMemory];
     DLog(@"%s", __PRETTY_FUNCTION__);
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
     [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
}

-(BOOL)isLogin
{
    if ([[ZShare sharedInstance] isLogin]) {
        return YES;
    }else
    {
        UserNavigationController *viewcontroller =[UserNavigationController newWithCameraDelegate:self];
        [self presentViewController:viewcontroller animated:NO completion:nil];
        
        return NO;
    }
    return NO;
}
-(void)userLoginOK:(id)userinfo
{
    [self dismissViewControllerAnimated:YES completion:nil];
}
-(void)userDidCancel
{
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleBlackTranslucent;
}
- (BOOL)prefersStatusBarHidden
{
    return NO;
}

@end
